﻿/*-------------------------------------------------------------------------
* 命名空间: WaferSelectV3.DAL.LocalDataAccess/LevelCountHistoryAccess
* 类       名: LevelCountHistoryAccess
* 功      能:  TD
* 时      间:  2024/5/9 20:53:22
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using System;
using WaferSelectV3.Common;
using WaferSelectV3.DAL.DataEntity;
using WaferSelectV3.Extensions;
using WaferSelectV3.Services;

namespace WaferSelectV3.DAL.LocalDataAccess
{
    public class LevelCountHistoryAccess
    {
        public static DataResult AddLevelCountHistorySingle(LevelCountHistoryEntity entityAdd)
        {
            DataResult result = new DataResult();
            try
            {
                using(var context = new DataContext())
                {
                    context.LevelCountsHistory.Add(entityAdd);
                    int affectedRows = context.SaveChanges();
                    if(affectedRows  > 0)
                    {
                        result.State = true;
                    }
                    else
                    {
                        result.Message = ConstantProvider.DatabaseAddError;
                    }
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.GetFullException();
            }
            return result;
        }
    }
}
